package com.soar.tbox.protocol;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import android.annotation.SuppressLint;

import com.soar.tbox.CommandStorage;
import com.soar.tbox.DisplayHandler;
import com.soar.tbox.Messenger;
import com.soar.tbox.bean.Command;
import com.soar.tbox.bean.Paramter;
import com.soar.tbox.util.Converts;
import com.soar.tbox.util.LogUtil;
import com.soar.tbox.util.SettingHelper;

/**
 * 车辆诊断查询
 * 
 * @author songjunjie
 * 
 */
public class Protocol0601 implements Protocol {
	/**
	 * 指令名. 车辆诊断查询
	 */
	private static final String NAME = "0601";

	private Command cmd = null;
	private String serialNum = null;

	public Protocol0601(Command cmd, String serialNum) {
		this.cmd = cmd;
		this.serialNum = serialNum;
	}

	@SuppressLint("SimpleDateFormat")
	@Override
	public void handle() {
		DisplayHandler.show("执行车辆诊断查询指令");
		Command resultCommand = CommandStorage.getCommand(NAME);
		resultCommand.setSerialNum(serialNum);
		Messenger messenger = new Messenger();
		try {
			messenger.send(resultCommand, false);
			DisplayHandler.show("执行车辆诊断查询指令完成");
		} catch (Exception e) {
			DisplayHandler.show("发送指令出现错误."+e.getMessage());
			LogUtil.error("", e);
			e.printStackTrace();
		}
		
	}
}